
** file to get list of active ISD weather stations


***inputs:
*  $OrigData/isd-history-2.xlsx

***outputs:
* $Data/isd_us_stations.dta
* $Data/activeisd_us_stations.dta


clear

import excel $OrigData/isd-history-2.xlsx

	rename A USAF
	rename B WBAN
	rename C STATION_NAME
	rename D CTRY
	rename E ST_CALL
	rename F LAT
	rename G LON
	rename H ELEV
	rename I BEGIN
	rename J END

	keep if CTRY=="US"
	save $Data/isd_us_stations.dta,replace

use $Data/isd_us_stations.dta, clear

	

	tostring BEGIN, gen(str_start) usedisplayformat
	tostring END, gen(str_end) usedisplayformat

	gen start_date = date(str_start,"YMD")
	format start_date %td

	gen end_date = date(str_end,"YMD")
	format end_date %td

	keep if start_date <=td(01jan2013)
	keep if end_date >= td(31dec2018)
save $Data/activeisd_us_stations.dta, replace

